//
//  CheckNetWork.m
//  电销宝
//
//  Created by welldone on 13-4-10.
//  Copyright (c) 2013年 com.welldone. All rights reserved.
//

#import "CheckNetWorkTool.h"


@implementation CheckNetWorkTool

+(BOOL)isExistenceNetwork
{
	BOOL isExistenceNetwork = NO;
	Reachability *r = [Reachability reachabilityWithHostName:@"www.baidu.com"];
    
    switch ([r currentReachabilityStatus]) {
        case NotReachable:
            NSLog(@"没有网络连接");
            isExistenceNetwork = NO;
            break;
        case ReachableViaWWAN:
            NSLog(@"使用3G网络");
            isExistenceNetwork = YES;
            break;
        case ReachableViaWiFi:
            NSLog(@"使用WiFi网络");
            isExistenceNetwork = YES;
            break;
    }
	return isExistenceNetwork;
}


+(NetworkStatus)getNetWorkStatus{
    
    Reachability *r = [Reachability reachabilityWithHostName:@"www.baidu.com"];
    
    return r.currentReachabilityStatus;
}

@end
